package com.xinlu.common.game.bo;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.xinlu.common.game.dao.WcSjglDao;
import com.xinlu.common.game.value.WcSjglVo;
import com.xinlu.persistence.WcSjgl;
import com.xinlu.util.tool.DateUtil;

public class WcSjglBo {
	
	/********	Dao对象注入	************/
	private WcSjglDao wcSjglDao;
	
	public void setWcSjglDao(WcSjglDao wcSjglDao) {
		this.wcSjglDao = wcSjglDao;
	}


	public List getLottyList(String yymmdd, String yxms){
		
		String hhmmss = DateUtil.getFormatDate(DateUtil.HH_MI_SS, new Date());
		
		if (yymmdd == null || yymmdd == "") {
			
			yymmdd = "2009/12/01";
		}
		
		Timestamp currentTime = DateUtil.getTimestamp(DateUtil.getDate(DateUtil.YYYY_MM_DD_HH_MI_SS, yymmdd + " " + hhmmss));
		
		
		List<WcSjgl> reList = this.wcSjglDao.getLottyList(currentTime, yxms);
		List<WcSjgl> tranList = null;
		if (reList != null && reList.size() > 0) {
			
			tranList = new ArrayList<WcSjgl>();
			
			for (WcSjgl wcSjgl : reList) {
				
				if (yxms.contains("CQSSC")) {
					
					wcSjgl.setQh(DateUtil.getFormatDate(DateUtil.YYYYMMDD, new Date())  + wcSjgl.getQh());
				}else if (yxms.contains("JXSSC")) {
					
					wcSjgl.setQh(DateUtil.getFormatDate(DateUtil.YYYYMMDD, new Date()) + "0"  + wcSjgl.getQh());
				}else if (yxms.contains("HLJSSC")) {
					
					wcSjgl.setQh("100570" + wcSjgl.getQh());
				}
				
				tranList.add(wcSjgl);
			}
			
			
		}
		return tranList;
	}
	
	
	public WcSjglVo getNewQishuAndJiezhishijian(String yymmdd, String yxms){
		
		String hhmmss = DateUtil.getFormatDate(DateUtil.HH_MI_SS, new Date());
		
		if (yymmdd == null || yymmdd == "") {
			
			yymmdd = "2009/12/01";
		}
		
		
		WcSjgl po = this.wcSjglDao.getNewQishuXinxi(DateUtil.getDate(DateUtil.YYYY_MM_DD_HH_MI_SS, yymmdd + " " + hhmmss), yxms);
		
		if (po != null) {
			
			WcSjglVo vo = new WcSjglVo();
			
			if (yxms.contains("CQSSC")) {
				
				vo.setQh((DateUtil.getFormatDate(DateUtil.YYYYMMDD, new Date()) + po.getQh()));
			}else if (yxms.contains("JXSSC")) {
				
				vo.setQh((DateUtil.getFormatDate(DateUtil.YYYYMMDD, new Date()) + "0" + po.getQh()));
			}else if (yxms.contains("HLJSSC")) {
				
				vo.setQh("100569" + po.getQh());
			}
			
//			vo.setQh(DateUtil.getFormatDate(DateUtil.YYYYMMDD, DateUtil.getCurrentdate())  + po.getQh());
			
			vo.setQs(po.getQh());
			//	截止时间
			vo.setQsjzsj(DateUtil.getFormatDate(DateUtil.YYYYMMDD, new Date()) + " " + DateUtil.getFormatDate(DateUtil.HH_MI_SS, new Date(po.getQsjzsj().getTime())));
			
			vo.setDgjssj(DateUtil.getFormatDate(DateUtil.YYYY_MM_DD, DateUtil.getCurrentdate()) + " " + DateUtil.getFormatDate(DateUtil.HH_MI, new Date(po.getQsjzsj().getTime())));
			
			vo.setNowtime(DateUtil.getFormatDate(DateUtil.YYYYMMDDHHMISS, new Date()));
			
			return vo;
		}else{
			
			//vo.setQh(DateUtil.getFormatDate(DateUtil.YYYYMMDD, DateUtil.getCurrentdate()) + "-" + po.getQh());
			
			//vo.setQs("暂不开奖..");
			//	截止时间
			//vo.setQsjzsj(DateUtil.getFormatDate(DateUtil.HH_MI_SS, new Date(po.getQsjzsj().getTime())));
		}
		//	开奖时间
		//	vo.setDgjssj(DateUtil.getFormatDate(DateUtil.YYYYMMDD, DateUtil.getCurrentdate()) + " " + DateUtil.getFormatDate(DateUtil.HH_MI_SS, new Date(po.getQsjzsj().getTime())));
		
		
		
		return null;
	}
	
}
